package net.lab0.tools.evo.test.stubs;

import net.lab0.tools.evo.BinaryIndividual;
import net.lab0.tools.evo.iface.IndividualFactory;

public class IndividualFactoryImplementation
implements IndividualFactory<BinaryIndividual>
{
    private int defaultSize;
    
    /**
     * 
     * @param defaultSize
     *            the size of the individuals to create.
     * @throws IllegalArgumentException
     *             if the size is not positive.
     */
    public IndividualFactoryImplementation(int defaultSize)
    throws IllegalArgumentException
    {
        super();
        if (defaultSize < 1)
        {
            throw new IllegalArgumentException("Size must be >= 1");
        }
        this.defaultSize = defaultSize;
    }
    
    @Override
    public BinaryIndividual createNewIndividual()
    {
        return new BinaryIndividual(defaultSize);
    }
    
}
